package com.itheima.tlias84;

import com.itheima.tlias84.entity.Teacher;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@SpringBootApplication
public class Tlias84Application {

    public static void main(String[] args) {
        SpringApplication.run(Tlias84Application.class, args);
    }

    /**
     * 通过 @Bean创建的Bean对象默认是创建该Bean的方法名
     * 一般用于自动配置第三方对象的连接信息对象，例如阿里云oss
     * @return
     */
    @Bean("zhangsan")
    public Teacher createTeacherOne() {
        Teacher teacher = new Teacher();
        teacher.setAge(18);
        teacher.setName("张三");
        return teacher;
    }

    @Bean("lisi")
    public Teacher createTeacherTwo() {
        Teacher teacher = new Teacher();
        teacher.setAge(16);
        teacher.setName("李四");
        return teacher;
    }

}
